n, m = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
s = set()
dp = [0]
for i, item in zip(range(len(a)), a[::-1]):
if item in s:
dp.append(dp[i])
else:
dp.append(dp[i] + 1)
s.add(item)
for i in range(m):
k = int(input())
print(dp[n + 1 - k])
#include <bits/stdc++.h>
#define ANIME ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define ld long double
using namespace std;
int main()
{
ANIME
int n,m;
cin>>n>>m;
int arr[n],suffix[n]={0};
map<int,bool>mm;
for(int i=0;i<n;i++) cin>>arr[i];
suffix[n-1]=1;mm[arr[n-1]]=1;
for(int i=n-2;i>=0;i--)
{
if(mm[arr[i]])
{
suffix[i]=suffix[i+1];
}
else
{
suffix[i]=suffix[i+1]+1;
mm[arr[i]]=1;
}
}
for(int i=0;i<m;i++)
{
int x;
cin>>x;
cout<<suffix[x-1]<<"\n";
}
return 0;
}
81A - Plug-in | 276C - Little Girl and Maximum Sum |
1738D - Permutation Addicts | 1348B - Phoenix and Beauty |
186A - Comparing Strings | 1281A - Suffix Three |
1421C - Palindromifier | 1443A - Kids Seating |
963A - Alternating Sum | 1191B - Tokitsukaze and Mahjong |
1612G - Max Sum Array | 1459B - Move and Turn |
1006F - Xor-Paths | 706C - Hard problem |
304C - Lucky Permutation Triple | 1301C - Ayoub's function |
38E - Let's Go Rolling | 171G - Mysterious numbers - 2 |
1183C - Computer Game | 400C - Inna and Huge Candy Matrix |
417A - Elimination | 222A - Shooshuns and Sequence |
1736A - Make A Equal to B | 1736B - Playing with GCD |
887C - Solution for Cube | 1737C - Ela and Crickets |
1741C - Minimize the Thickness | 1741A - Compare T-Shirt Sizes |
1741D - Masha and a Beautiful Tree | 109B - Lucky Probability |